#include<stdio.h>
#include<string.h>

int main()
{
	int h=0,sign,flag=0,n=0,mfactor=0;
	char c[101]={'\0'};
	gets(c);
	for(sign=0;sign<strlen(c);sign++)
	{
		if(c[sign]>='0'&&c[sign]<='9')
		{
			n=10*n+c[sign]-'0';
			flag=1;
		}
	}
	if(flag==0) printf("0");
	else
	{
		for(sign=1;sign<=n/2.0;sign++)
		{
			if(n%sign==0) mfactor=sign;
		}
		if(sign==2) printf("%d",n);
		else printf("%d",mfactor);
	}
	
	return 0;
}
